package com.eportal.params.background.mall.Tcommodity;

import com.eportal.entity.TCommodityPriceEntity;
import com.eportal.entity.TCommodityPropertyEntity;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.Digits;
import java.io.Serializable;
import java.util.List;

/**
 * 添加商品参数
 * Created by Saber on 2017/7/10.
 */
public class CommodityParam implements Serializable{

    private static final long serialVersionUID = 8362371016935158389L;

    /**
     * 商品表主键（添加时为空)）
     */
    private Long sId;

    /**
     * 商品名称
     */
    @NotBlank(message = "商品名称不能为空")
    @Length(min = 1,max = 20,message = "商品长度为1到20")
    private String cname;

    /**
     * 库存
     */
    @Digits(integer = 8,fraction = 0,message = "库存不能为空")
    private Integer stock;

    /**
     * 商品图片（主图 1张）
     */
    private String photo;

    /**
     * 商品图片（详情图 最多4张)）
     */
    private String attrPhoto;

    /**
     * 商品价格（接受前台传参使用)
     */
    private String priceJSONStr;

    /**
     * 商品价格（后台使用）
     */
    private List<TCommodityPriceEntity> prices;

    /**
     * 商品属性（接受前台传参使用)
     */
    @NotBlank(message = "商品属性不能为空")
    private String goodArrtibuteJSONStr;

    /**
     * 商品属性（后台使用)）
     */
    private List<TCommodityPropertyEntity> goodArrtibutes;


    public Long getsId() {
        return sId;
    }

    public void setsId(Long sId) {
        this.sId = sId;
    }

    public String getCname() {
        return cname;
    }

    public void setCname(String cname) {
        this.cname = cname;
    }

    public Integer getStock() {
        return stock;
    }

    public void setStock(Integer stock) {
        this.stock = stock;
    }

    public String getPhoto() {
        return photo;
    }

    public void setPhoto(String photo) {
        this.photo = photo;
    }

    public String getAttrPhoto() {
        return attrPhoto;
    }

    public void setAttrPhoto(String attrPhoto) {
        this.attrPhoto = attrPhoto;
    }

    public String getPriceJSONStr() {
        return priceJSONStr;
    }

    public void setPriceJSONStr(String priceJSONStr) {
        this.priceJSONStr = priceJSONStr;
    }

    public List<TCommodityPriceEntity> getPrices() {
        return prices;
    }

    public void setPrices(List<TCommodityPriceEntity> prices) {
        this.prices = prices;
    }

    public String getGoodArrtibuteJSONStr() {
        return goodArrtibuteJSONStr;
    }

    public void setGoodArrtibuteJSONStr(String goodArrtibuteJSONStr) {
        this.goodArrtibuteJSONStr = goodArrtibuteJSONStr;
    }

    public List<TCommodityPropertyEntity> getGoodArrtibutes() {
        return goodArrtibutes;
    }

    public void setGoodArrtibutes(List<TCommodityPropertyEntity> goodArrtibutes) {
        this.goodArrtibutes = goodArrtibutes;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("CommodityParam{");
        sb.append("sId=").append(sId);
        sb.append(", cName='").append(cname).append('\'');
        sb.append(", stock=").append(stock);
        sb.append(", photo='").append(photo).append('\'');
        sb.append(", attrPhoto='").append(attrPhoto).append('\'');
        sb.append(", priceJSONStr='").append(priceJSONStr).append('\'');
        sb.append(", prices=").append(prices);
        sb.append(", goodArrtibuteJSONStr='").append(goodArrtibuteJSONStr).append('\'');
        sb.append(", goodArrtibutes=").append(goodArrtibutes);
        sb.append('}');
        return sb.toString();
    }
}







